#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QPushButton* button = new QPushButton(this);
    button->setText("关闭");
    button->move(350,250);
    connect(button,&QPushButton::clicked,this,&Widget::close);
    connect(this,&Widget::mySignal,this,&Widget::handleMySignal);


}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleRequest()
{
    this->setWindowTitle("按钮已被按下");
}

void Widget::handleMySignal(const QString& text)
{
    this->setWindowTitle(text);
}


void Widget::on_pushButton_clicked()
{
    this->setWindowTitle("按钮2已被按下");
}

void Widget::on_pushButton_2_clicked()
{
    emit mySignal("文本1号信号已经发射");
}

void Widget::on_pushButton_3_clicked()
{
    emit mySignal("文本2号信号已经发射");
}
